package java8.date;

import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.time.format.FormatStyle;
import java.util.Locale;

public class LocalTimeDemo {
    public static void main(String[] args) {
        LocalTime now = LocalTime.now();
        LocalTime other = LocalTime.of(12, 30, 59);
        System.out.println(now.isBefore(other));

        //16:53:44.389
        System.out.println(now.format(DateTimeFormatter.ISO_TIME));
        //16:53:44.389
        System.out.println(now.format(DateTimeFormatter.ISO_LOCAL_TIME));
        //16:53:44
        System.out.println(now.format(DateTimeFormatter.ofPattern("hh:mm:ss")));

        DateTimeFormatter germanFormatter =
                DateTimeFormatter
                        .ofLocalizedTime(FormatStyle.SHORT)
                        .withLocale(Locale.GERMAN);

        //16:40
        LocalTime localTime = LocalTime.parse("16:40", germanFormatter);

    }
}
